(function ($) {
  /* ------------------------------- */
  $(function(){
    load_event();
	load_tab();
			 })

})(jQuery);

/*image rollover*/
var load_event = function(){
  $('a>img[src*="-out-"],input[src*="-out-"]').each(function(){
    var $$ = $(this);
    $$.mouseover(function(){ $(this).attr('src', $(this).attr('src').replace(/-out-/,'-on-')) });
    $$.mouseout (function(){ $(this).attr('src', $(this).attr('src').replace(/-on-/,'-out-')) });
  });
}
var load_tab=function(){
	$('.usertab').each(function(i){
		var $usertab=	$(this);
		var $tabuser=$('.tab li');
		var $userinfor=$('.usertab p');
		var $tab=$('.tab_detail');
		$tab.hide();
		$tab.eq(0).show();
		$userinfor.eq(0).addClass('current');
		$tabuser.eq(0).css({'background':'#4D7EA9'});
	$usertab.unbind('click').bind('click',{index:i},function(e){
			var curent = $userinfor.index($('.usertab').find('.current:first'));
			if(curent!=e.data.index)
			{$tabuser.eq(curent).css({'background':'#82A4C3'});
					$tabuser.eq(e.data.index).css({'background':'#4D7EA9'});
				
				$tab.eq(curent).fadeOut(500,function(){
					$userinfor.removeClass('current');
					$userinfor.eq(e.data.index).addClass('current');
					
					$tab.eq(e.data.index).fadeIn(500);
				});
				
			}
			
			
	})	
	})
}






var useroption_event=function(){
	$('#option_button').each(function () {
	  $(this).unbind('click').bind('click',function () {
	  	console.log($('#user_status').attr('class'));
	  	if($('#activity_view').width()==314){
  			$('#activity_panel').animate({"right" : "0px" }, 1500,function () {
				$('#activity_view').width(32);
				$('#user_status').fadeTo("slow", 1.0, function () {					
					$('#user_status').addClass('Big_status_show');
				  }).css({'z-index':2});
			  }); 
  		}else if($('#user_status').attr('class')=='Big_status_show'){
  			$('#user_status').fadeTo("slow", 0, function () {
				$('#user_status').removeClass('Big_status_show').css({'z-index':0});;
			  });
  		}else{
  			$('#user_status').fadeTo("slow", 1.0, function () {
				$('#user_status').addClass('Big_status_show');
			  }).css({'z-index':2});
  		}
		
	  });
	  $('#user_status').unbind('click').bind('click',function () {
		$('#user_status').fadeTo("slow", 0, function () {
				$('#user_status').removeClass('Big_status_show').css({'z-index':0});;
			  });
	  })
	})
}

